aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/[username]/+layout.server.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2024-09-10 20:39:47 -0700
committerAdam Soltys <[email protected]>2024-09-17 09:18:36 -0700
commit1f63848ca9fb01336f04b41434de1cc06a5b3d93 (patch)
tree2affa3041863be365f33d99e1f32bda60cf93a32 /src/routes/(app)/[username]/+layout.server.ts
parent6e48c584605bec5623c12c470d04d07303983801 (diff)
downloadcoinos-ui-1f63848ca9fb01336f04b41434de1cc06a5b3d93.tar.gz
coinos-ui-1f63848ca9fb01336f04b41434de1cc06a5b3d93.zip
move routes
Diffstat (limited to 'src/routes/(app)/[username]/+layout.server.ts')
-rw-r--r--src/routes/(app)/[username]/+layout.server.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/routes/(app)/[username]/+layout.server.ts b/src/routes/(app)/[username]/+layout.server.ts
index 11e6d45c..c340544d 100644
--- a/src/routes/(app)/[username]/+layout.server.ts
+++ b/src/routes/(app)/[username]/+layout.server.ts
@@ -1,17 +1,25 @@
import { get } from "$lib/utils";
import { error } from "@sveltejs/kit";
-export let load = async ({ cookies, depends, params: { username } }) => {
+export let load = async ({
+ cookies,
+ depends,
+ params: { username },
+ parent,
+}) => {
depends("app:user");
try {
let subject = await get(`/users/${username}`);
+ let { user } = await parent();
+ if (!user) user = subject;
+ console.log("SUBJECT", subject)
let expires = new Date();
expires.setSeconds(expires.getSeconds() + 380 * 24 * 60 * 60);
cookies.set("username", username, { path: "/", expires });
- return { subject };
+ return { subject, user };
} catch (e) {
error(500, "Unable to retrieve user account data");
}